package com.sample.snl.frontend.SyntaxAnalysis;

import com.sample.snl.frontend.LexicalAnalysis.Token;
import com.sample.snl.frontend.LexicalAnalysis.TokenType;

public class TerminalSymbol extends Symbol {
    private Node node;
    private Token token;
    public static final TerminalSymbol epsilon = new TerminalSymbol(new Token("empty"));

    TerminalSymbol(Token token) {
        this.token = token;
        this.node = new Node(token.getLexeme());
    }

    TerminalSymbol(TokenType type) {
        this(new Token(type));
    }

    public Token getToken() {
        return token;
    }

    public Node getNode() {
        return this.node;
    }

    @Override
    public String toString() {
        return "[" + token.getType() + "|" + token.getLexeme() + "]";
    }
}
